package src.stringTest;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: tao
 * Date: 2023-11-20
 * Time: 14:16
 */
public class Test2 {
    public static void main(String[] args) {
        String s1 = new String("ab");
        String s2 = new String("ac");
        String s3 = new String("ab");
        String s4 = new String("abcdef");
        System.out.println(s1.compareTo(s2)); // 不同输出字符差值-1
        System.out.println(s1.compareTo(s3)); // 相同输出 0
        System.out.println(s1.compareTo(s4)); // 前k个字符完全相同，输出长度差值 -3
    }
}
